perm filename TMP.TMP[TEX,ALS]1 blob
sn#608104 filedate 1981-08-24 generic text, type T, neo UTF8
\input dochdr
\secbegin \def\dispentry#1#2{{}
\spaceskip 3.333pt plus 10pt minus 2pt
\xspaceskip 4.444pt plus 11pt minus 3pt
\parindent 0pt
$$\hbox par 11cm{\hangindent 3cm after 1\hbox to 3cm{#1\hfil\quad}#2}
$$
\parindent 20pt
}
\def\dispar#1\par{{}
\spaceskip 3.333pt plus 10pt minus 2pt
\xspaceskip 4.444pt plus 11pt minus 3pt
\parindent 0pt
$$\hbox par 10cm{#1}
$$
\parindent 20pt
}
\def\hide#1{\hbox to 0pt{\hss#1}}
\def\α{\hide{-}\ }
\def\β{\hide{$\bullet$}\ }
\def\runningrighthead#1{\gdef\chead{\:m#1}} %\runningrighthead sets chead
\advcount0
\secbegin \head{THE SYSTEM DEPENDENT MODULE OF \TEX}\runninglefthead{\TEX: SYSTEM DEPENDENCIES}
This module contains all the parts of \TEX\
that may need some reprogramming for each different system environment.
If a compiler does not suport external procedures or there is no interest
in reprogramming them to generate more efficient code, it is possible
to get by just doing as follows:
\dispar \hide{-} Make all necessary changes in this module.\par
\dispar \hide{-} Modify the beginning sections of \.{TEX.DOC} accordingly.\par
\dispar \hide{-} Delete the first, second and last pages of
\.{SYSDEP.DOC} (the one file you are now reading).\par
\dispar \hide{-} Put the remaining of this module in the place of the external
procedure declarations in \.{TEX.DOC}.\par
the result will be ready for \.{UNDOC} to produce a single \.{TEX.PAS}
source file.\par
The data structures declared in \TEX\ have been
designed having in mind a machine and a compiler
that packs fields correctly to the byte. That means that
fields in some records are allocated more space than necessary and, some times,
records take extra words to allocate fields that could have been allocated
in prevously assigned words. But the wasted extra space is not very significant,
and probably does not justify the effort to change the structures here and
in the main module. Rather, the size of the structures should be modified if
the memory space is at premium.
\pascal
\1\3\2\&{program} $\\{sysdep},\45\\{InitStrings},\45\\{ProduceString},\45
\\{AppndString},\45\\{AppndReal},\45\\{InitSysdep}
,\45\\{Release},\45\\{InChTer},\45\\{InLnTer}
,\45\\{OutChErr},\45\\{OutLnErr},\45\\{SendCh},\45
\\{SendLn},\45\\{SendStarted},\45\\{Close},\45\\{Print}
,\45\\{PrintLn},\45\\{PrintInt},\45\\{PrintReal}
,\45\\{PrintFileName},\45\\{PrintOctal},\45
\\{InLn},\45\\{GetFirstLine},\45\\{ForceBufferOut}
,\45\\{TraceLine},\45\\{DeclareOFil},\45\\{InitFileName}
,\45\\{AppendToName},\45\\{ReadFontInfo},\45
\\{DvI},\45\\{IntOut},\45\\{CloseOut},\45\\{SetTableSizes}
,\45\\{WriteSecondMem},\45\\{WriteEqTb}
,\45\\{WriteHyphenTb},\45\\{WritePageTb},\45\\{WriteDelimTb}
,\45\\{WriteFMem},\45\\{GetTableSizes}
,\45\\{InitSecondMem},\45\\{InitEqTb},\45\\{InitHyphenTb}
,\45\\{InitPageTb},\45\\{InitDelimTb},\45
\\{InitFMem}$\1;
\3\2\1\&{const} $\null$\6Constants in the outer block{ \:m13\7}$\null
$
\3\2\1\&{type} $\null$\6Types in the outer block{ \:m5\7}$\null $
\3\2\1\&{var} $\null$\6Globals in the outer block{ \:m15\7}$\null
$
\secbegin Definitions for the memory of \TEX
\pascal
\1\3\2\1\&{define} \\{memsize} $=$ $49152\null$\40\ $\{\;$size of the main memory structure of \TEX$\;\}$
$\null
$
\3\2\1\&{define} \\{secondmem} $=$ $25012\null$\40\ $\{\;$size of the part of the main memory used in single node blocks$\;\}$
$\null
$
\secbegin Definitions for the table of equivalents
\pascal
\1\3\2\1\&{define} \\{hprime} $=$ $89\null$\40\ $\{\;$range of hash values$\;\}$
$\null
$
\3\2\1\&{define} \\{hashsize} $=$ $1009\null$\40\ $\{\;$hash table size, must be prime and $<2↑{bound\ of\ \\{sixteenbits}-127}$$\;\}$
$\null
$
\3\2\1\&{define} \\{texpars} $=$ $21\null$\40\ $\{\;$number of distinct parameters settable by \.{\\chpar}$\;\}$
$\null
$
\3\2\1\&{define} \\{locs} $=$ $23\null$\40\ $\{\;$values of local quantities (\.{\\:},\.{\\baselineskip}, etc.)$\;\}$
$\null
$
\3\2\1\&{define} \\{eqtbsize} $=$ $\\{hashsize}+128+128+128+15+\\{texpars}\null$\40\ $\{\;$size of table for current values$\;\}$
$\null
$
\secbegin Next follows a list of constants that can be adjusted for each installation
\pascal
\1\3\2\1\&{define} \\{stacksize} $=$ $80\null$\40\ $\{\;$size of input stacks$\;\}$
$\null
$
\3\2\1\&{define} \\{pagememsize} $=$ $8\null$\40\ $\{\;$number of page parameters$\;\}$
$\null
$
\3\2\1\&{define} \\{nfonts} $=$ $64\null$\40\ $\{\;$number of fonts allowed (must not be greater than 256)$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfnt} $=$ $\\{nfonts}-1\null$\40\ $\{\;$highest font number$\;\}$
$\null
$
\3\2\1\&{define} \\{charsperfont} $=$ $128\null$\40\ $\{\;$assumed number of characters in a font$\;\}$
$\null
$
\3\2\1\&{define} \\{maxinfil} $=$ $6\null$\40\ $\{\;$maximum number of input files that can be open at the
same time$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfil} $=$ $\\{nfonts}+10+\\{maxinfil}\null$\40\ $\{\;$maximum number of file names \TEX\ remembers$\;\}$
$\null
$
\3\2\1\&{define} \\{bufsize} $=$ $200\null$\40\ $\{\;$size of the input buffer$\;\}$
$\null
$
\3\2\1\&{define} \\{maxlinelength} $=$ $150\null$\40\ $\{\;$maximum number of characters accepted
in a line of a file$\;\}$
$\null
$
\3\2\1\&{define} \\{exceptableEntryLength} $=$ $2\null$\40\ $\{\;$size of exceptable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{excephyphEntryLength} $=$ $2\null$\40\ $\{\;$size of excephyph entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{suffixEntryLength} $=$ $3\null$\40\ $\{\;$size of suffix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{prefixEntryLength} $=$ $3\null$\40\ $\{\;$size of prefix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{btableEntryLength} $=$ $3\null$\40\ $\{\;$size of btable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{readoutsize} $=$ $3\null$\40\ $\{\;$maximum size of the above$\;\}$
$\null
$
\3\2\1\&{define} \\{excepsize} $=$ $373\null$\40\ $\{\;$length of hyphenation tables: there should always
some slack in the exception table to allow for
efficient hashing; since it is used as the hash
modulo, the length should always be prime$\;\}$
$\null
$
\3\2\1\&{define} \\{sufsize} $=$ $116$
\3\2\1\&{define} \\{prefsize} $=$ $109$
\3\2\1\&{define} \\{btabsize} $=$ $30$
\3\2\1\&{define} \\{fmemsize} $=$ $6400\null$\40\ $\{\;$size of font memory for secondary tables$\;\}$
$\null
$
\3\2\1\&{define} \\{fontinfosize} $=$ $8192\null$\40\ $\{\;$$\\{nfonts}\times 128$$\;\}$
$\null
$
\3\2\1\&{define} \\{bytesPerWord} $=$ $4\null$\40\ $\{\;$valid both for 32 and 36 bits per word$\;\}$
$\null
$
\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{oneOfTwo}=1\mathrel{\!.\,.\!}2$;
\2$\\{oneOfFour}=1\mathrel{\!.\,.\!}4$;
\2$\\{oneOfFive}=1\mathrel{\!.\,.\!}5$;
\2$\\{oneOfSix}=1\mathrel{\!.\,.\!}6$;\40\ $\{\;$these types are useful in more complicated declarations.$\;\}$
\note See also sections 8, 11, 24, 31, 58, 71, 73, and 74.
\note This code is used in section 1.
\secbegin Ascii codes for some characters not recognized by the preprocessor
\pascal
\1\3\2\1\&{define} \\{null} $=$ $\hbox{\char'16}0$
\3\2\1\&{define} \\{linefeed} $=$ $\hbox{\char'16}12$
\3\2\1\&{define} \\{formfeed} $=$ $\hbox{\char'16}14$
\3\2\1\&{define} \\{carriagereturn} $=$ $\hbox{\char'16}15$
\3\2\1\&{define} \\{zero} $=$ $\hbox{\char'16}60$
\3\2\1\&{define} \\{one} $=$ $\hbox{\char'16}61$
\3\2\1\&{define} \\{two} $=$ $\hbox{\char'16}62$
\3\2\1\&{define} \\{three} $=$ $\hbox{\char'16}63$
\3\2\1\&{define} \\{four} $=$ $\hbox{\char'16}64$
\3\2\1\&{define} \\{five} $=$ $\hbox{\char'16}65$
\3\2\1\&{define} \\{six} $=$ $\hbox{\char'16}66$
\3\2\1\&{define} \\{seven} $=$ $\hbox{\char'16}67$
\3\2\1\&{define} \\{eight} $=$ $\hbox{\char'16}70$
\3\2\1\&{define} \\{nine} $=$ $\hbox{\char'16}71$
\secbegin \head{The basic record employed by \TEX}\par
Most of \TEX's data structures are built on top of a single record
structure which is expected to be efficiently stored and accessed in
most systems. That record is declared below.
\pascal
\1\3\2\1\&{define} \\{eightbits} $≡$ $0\mathrel{\!.\,.\!}255\null$\40\ $\{\;$an 8-bit field$\;\}$
$\null
$
\3\2\1\&{define} \\{sixteenbits} $≡$ $0\mathrel{\!.\,.\!}65535\null$\40\ $\{\;$a 16-bit field$\;\}$
$\null
$
\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{halves2}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{lhword}\mathrel:\\{sixteenbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{bytes4}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{byte0}\mathrel:\\{eightbits}$;
\2$\\{byte1}\mathrel:\\{eightbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{memoryword}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0\1\&{case} $\\{oneOfFour}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{pts}\mathrel:\\{real}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{int}\mathrel:\\{integer}$)
\3;
\2\1$3\mathrel:\null$
(\0$\\{twohalves}\mathrel:\\{halves2}$)
\3;
\2\1$4\mathrel:\null$
(\0$\\{fourbytes}\mathrel:\\{bytes4}$)
\3\3\2\&{end}$\null\3
$;
\secbegin The following are definitions, types and globals employed all over
the program. Corresponding definitions appear at the beginning of the main
module of \TEX.
Syntactic sugar first
\pascal
\1\3\2\1\&{define} \\{continue} $=$ $10\null$\40\ $\{\;$end of body of loop$\;\}$
$\null
$
\3\2\1\&{define} \\{return} $=$ $50\null$\40\ $\{\;$go here to exit a procedure$\;\}$
$\null
$
\3\2\1\&{define} \\{done} $=$ $0\null$\40\ $\{\;$some labels for loop exits$\;\}$
$\null
$
\3\2\1\&{define} \\{done1} $=$ $1$
\3\2\1\&{define} \\{done2} $=$ $2$
\3\2\1\&{define} \\{failure} $=$ $1$
\3\2\1\&{define} \\{malformedname} $=$ $2$
\3\2\1\&{define} \\{needmore} $=$ $3$
\secbegin \6Loop exits{ \:m10\7} \.{+=}\par
\pascal
\2$\\{done}$
\3\2\1\&{define} \\{terminal} $≡$ $-1\null$\40\ $\{\;$identifier for the terminal$\;\}$
$\null
$
\3\2\1\&{define} \\{inputFile} $≡$ $-2\null$\40\ $\{\;$identifier for the {\it current} input file$\;\}$
$\null
$
\3\2\1\&{define} \\{outputFile} $≡$ $-3\null$\40\ $\{\;$identifier for the output file$\;\}$
$\null
$
\3\2\1\&{define} \\{dummyFont} $=$ $\\{maxfnt}+1$
\3\2\1\&{define} \\{filnam}\.{(\char'43)} $≡$ $(-(\.{\char'43})-2)\null$\40\ $\{\;$indices \\f in the \\{fileName} array are usually
passed as \\{filnam}(\\f) to procedures dealing with
strings, to help them find out whether the argument
should be located in the \\{fileName} array or in
the \\{strngpool}$\;\}$
$\null
$
\3\2\1\&{define} \\{stringsize} $=$ $64\null$\40\ $\{\;$size of a printable message$\;\}$
$\null
$
\note This code is used in section 50.